package org.fangzz.cameramgr.cameramonitor.dto;

import org.fangzz.cameramgr.cameramonitor.model.Area;
import org.springframework.beans.BeanUtils;

import java.util.ArrayList;
import java.util.List;

public class AreaSummary {
    private Integer id;
    private String code;
    private String name;
    private String cityCode;

    public static AreaSummary convert(Area area){
        AreaSummary areaSummary = new AreaSummary();
        BeanUtils.copyProperties(area,areaSummary);
        return  areaSummary;
    }

    public static List<AreaSummary> convert(List<Area> areaList){
        List<AreaSummary> areaSummaries = new ArrayList<>();
        areaList.stream().forEach(Area->{
            areaSummaries.add(AreaSummary.convert(Area));
        });
        return areaSummaries;
    }


    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCityCode() {
        return cityCode;
    }

    public void setCityCode(String cityCode) {
        this.cityCode = cityCode;
    }
}
